<?php

// $Id$

require_once($WSC->get_site_inc_dir().'modules/tangra_cms/_sys/tcms_admin_page_w_fctrl_ua.class.php');
require_once($WSC->get_site_inc_dir().'modules/tangra_cms/forms/_ci/ci_type_attr/ci_type_attr_form_ctrl.class.php');


class CI_Type_Attr_Edit_WP extends TCMS_Admin_Page_W_FCtrl_UA {
	public function create_view($name = 'default') {
		$ret = new TCMS_Admin_Page_View($this, $name, 'modules/tangra_cms/pages/_ci/');

		return $ret;
	}


	public function init() {
		parent::init();

		$context = $this->get__context();
		if (!$context->exists_in_get('ci_type')) {
			throw new Tangra_Module_Exception('Expecting "ci_type" parameter');
		}

		$ci_type = $context->get_from_get('ci_type');
		$this->form_ctrl->set_permanent_external_param('ci_type', $ci_type);

		$this->export('ci_type', $ci_type);
	}


	protected function create_form_ctrl() {
		$dbc = $this->get_dbc();
		$tvm = $this->get_tvm();

		$ret = new CI_Type_Attr_Form_Ctrl('ci_type_attr', $tvm, $dbc, 'obj_id');


		return $ret;
	}


	protected function on_add_new() {

	}


	protected function create_default_redir_view() {
		$object = $this->form_ctrl->get_object();
		$redir_view = $this->create_redirect_view($this->get_redir_on_success(), array('manage' => $object->get_ci()));

		return $redir_view;
	}
}